﻿<div class="page-header">
    <h1>服务列表</h1>
</div>
<div class="row">
    <div class="col-md-7">
        <input type="text" class="form-control input-md-5" data-ng-disabled="canEditMethods" data-ng-model="query" placeholder="搜索服务名或服务描述">
        <input type="hidden" data-ng-model="queryWsID" />
    </div>
    <div>
        <input type="button" data-ng-disabled="canEditMethods" class="btn btn-default" value="刷新" data-ng-click="refreshWebServices()" />
    </div>
</div>
<!--<form class="form-inline">
    <div class="form-group">
        <input type="text" class="form-control input-md-5" data-ng-disabled="canEditMethods" data-ng-model="query" placeholder="搜索服务名或服务描述">
        <input type="button" data-ng-disabled="canEditMethods" class="btn btn-default" value="编辑" />
    </div>
</form>-->

<table class="table table-bordered" style="margin-top: 20px;">
    <thead>
        <tr>
            <th class="col-md-1">序号</th>
            <th class="col-md-3">服务名</th>
            <th>服务描述</th>
            <th class="col-md-1">排序</th>
            <th class="col-md-3">操作</th>
        </tr>
    </thead>
    <tbody>
        <tr data-ng-repeat="ws in webServices | filter:queryFilter">
            <td>{{$index+1}}</td>
            <td>{{ws.ServiceName}}</td>
            <td>{{ws.ServiceDesc}}</td>
            <td>
                <input data-ng-disabled="canEditMethods" class="form-control" type="text" data-ng-model="ws.Sort" data-ng-change-on-blur="changeSort(ws)" />
            </td>
            <td>
                <input type="button" data-ng-disabled="canEditMethods" class="btn btn-default" value="方法表" data-ng-click="showMethods(ws)" />
                <input type="button" data-ng-disabled="canEditMethods" class="btn btn-default" value="编辑" data-ng-click="editService(ws)" data-target="#editServiceModal" data-toggle="modal" />
                <input type="button" data-ng-disabled="canEditMethods" class="btn btn-default" value="附件" data-ng-click="editServiceAttachments(ws)" data-target="#attachmentsModal" data-toggle="modal" />
                <input type="button" data-ng-disabled="canEditMethods" class="btn btn-danger" value="删除" data-ng-click="delWebService(ws,$index)" />
            </td>
        </tr>
    </tbody>
</table>

<!-- 方法表 panel -->
<div class="panel panel-default" data-ng-show="canEditMethods">
    <div class="panel-heading">
        <div class="row">
            <div class="col-md-11">
                <span>方法表</span>
            </div>
            <div class="col-md-1">
                <input type="button" value="返回" class="btn btn-success" data-ng-click="backEditMethod()" />
            </div>
        </div>
    </div>
    <div class="panel-body">
        <table class="table table-bordered" style="margin-top: 20px;">
            <thead>
                <tr>
                    <th class="col-md-3">方法名</th>
                    <th>描述</th>
                    <th class="col-md-1">排序</th>
                    <th class="col-md-2">操作</th>
                </tr>
            </thead>
            <tbody>
                <tr data-ng-repeat="m in methods">
                    <td>{{m.MethodName}}</td>
                    <td>{{m.MethodDesc}}</td>
                    <td>
                        <input class="form-control" type="text" data-ng-model="m.Sort" data-ng-change-on-blur="changeMethodSort(m)" />
                    </td>
                    <td>
                        <!--<input type="button" class="btn btn-danger" value="删除" data-ng-click="delMethod(m,$index)" />-->
                        <input type="button" class="btn btn-primary" value="SOAP包" data-target="#myModal" data-toggle="modal" data-ng-click="showDataPacks(m)" />
                    </td>
                </tr>
            </tbody>
        </table>

    </div>
</div>

<!-- SOAP包配置 modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="width: 1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">SOAP包配置</h4>
            </div>
            <div class="modal-body">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th class="col-xs-3">描述</th>
                            <th>包数据</th>
                            <th class="col-xs-1">排序</th>
                            <th class="col-xs-1">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr data-ng-repeat="dp in  dataPacks track by $index">
                            <td>
                                <textarea class="form-control" rows="9" data-ng-model="dp.SOAPRequestDesc"></textarea>
                            </td>
                            <td>
                                <textarea class="form-control" rows="9" data-ng-model="dp.DataPack"></textarea>
                            </td>
                            <td>
                                <input type="number" class="form-control" value="" data-ng-model="dp.Sort" /></td>
                            <td>
                                <input type="button" value="删除" data-ng-click="delDataPack(dp,$index)" class="btn btn-danger" /></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-ng-click="addNewDataPack()">新增</button>
                <button type="button" class="btn btn-primary" data-ng-click="saveDataPack()">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<!-- 编辑服务信息modal -->
<div class="modal fade" id="editServiceModal" tabindex="-1" role="dialog" aria-labelledby="editServiceLabel">
    <div class="modal-dialog" role="document" style="width: 1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="H1">{{curWebService.ServiceDesc}} - 信息编辑</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label>服务描述</label>
                        <input type="text" class="form-control" placeholder="服务描述" data-ng-model="curEditWebService.ServiceDesc">
                    </div>
                    <div class="form-group">
                        <label>WSDL地址</label>
                        <input type="text" class="form-control" placeholder="WSDL地址" data-ng-model="curEditWebService.WSDLAddress">
                    </div>
                    <div class="form-group">
                        <label>调用地址</label>
                        <input type="text" class="form-control" placeholder="WSDL地址" data-ng-model="curEditWebService.BindingAddress">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-ng-click="saveService()">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<!-- 附件管理modal -->
<div class="modal fade" id="attachmentsModal" tabindex="-1" role="dialog" aria-labelledby="attachmentsLabel">
    <div class="modal-dialog" role="document" style="width: 1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="H2">{{curWebService.ServiceDesc}} - 附件管理</h4>
            </div>
            <div class="modal-body">
                <div class="btn btn-default" ngf-select="upload($file)">选择文件上传</div>
                <!--<div class="btn btn-default" ngf-select="uploadFiles($files)" multiple="multiple">Upload on file select</div>-->

                <table class="table table-bordered" style="margin-top: 10px;">
                    <thead>
                        <tr>
                            <th class="col-md-1">序号</th>
                            <th>附件名称</th>
                            <th class="col-md-2">上传时间</th>
                            <th class="col-md-2">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr data-ng-repeat="item in attachments track by $index">
                            <td>{{$index + 1}}</td>
                            <td><a href="Download.aspx?aid={{item.ID}}" target="_blank">{{item.FileName}}</a></td>
                            <td>
                                <input type="datetime" class="form-control" data-ng-model="item.CreatedOn" data-ng-change-on-blur="chnageAttachmentCreatedOn(item)" />
                            </td>
                            <td>
                                <a href="Download.aspx?aid={{item.ID}}" target="_blank" class="btn btn-default">下载</a>
                                <input type="button" value="删除" class="btn btn-danger" data-ng-click="deleteAttachment(item,$index)" />

                            </td>
                        </tr>
                    </tbody>
                </table>
                <div class="alert alert-warning" role="alert" style="margin-top: 10px;" data-ng-show="errormsg.length > 0">
                    <p>{{errormsg}}</p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
